﻿using System;
using System.Data;
using System.Collections.Generic;
using EnterpriseFund.Model;
namespace EnterpriseFund.BLL
{
    /// <summary>
    /// AllowanceFile
    /// </summary>
    public partial class AllowanceFile
    {
        private readonly EnterpriseFund.DAL.AllowanceFile dal = new EnterpriseFund.DAL.AllowanceFile();
        public AllowanceFile()
        { }
        #region  BasicMethod
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public EnterpriseFund.Model.AllowanceFile GetModel(string FAllowanceFileID)
        {

            return dal.GetModel(FAllowanceFileID);
        }

                /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DataSet GetFIssueIDByFAllowanceFileID(string FAllowanceFileID)
        {
            return dal.GetFIssueIDByFAllowanceFileID(FAllowanceFileID);

        }

        public void Delete(string FAllowanceFileID)
        {
            dal.Delete(FAllowanceFileID);
        }
                /// <summary>
        /// 增加文件
        /// </summary>
        /// <param name="enList"></param>
        /// <param name="model"></param>
        public string Add(List<Model.AllowanceFileEntry> enList, Model.AllowanceFile model, string issueIDList)
        {
            return dal.Add(enList, model,issueIDList);
        }

               /// <summary>
        /// 增加文件
        /// </summary>
        /// <param name="enList"></param>
        /// <param name="model"></param>
        public void UpdateFile(List<Model.AllowanceFileEntry> enList, Model.AllowanceFile model, string issueIDList)
        {
            dal.UpdateFile(enList, model, issueIDList);
        }


        public string GetJe(string FSource, string FAllowanceFileID, string NSRDZDAH)
        {
            return dal.GetJe(FSource, FAllowanceFileID, NSRDZDAH);
        }

               /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<EnterpriseFund.Model.cboAllowanceFile> GetCboList(string NSRDZDAH)
        {
            DataSet ds = dal.GetCboList(NSRDZDAH);

            List<EnterpriseFund.Model.cboAllowanceFile> modelList = new List<EnterpriseFund.Model.cboAllowanceFile>();
            int rowsCount = ds.Tables[0].Rows.Count;
            if (rowsCount > 0)
            {
               
                for (int n = 0; n < rowsCount; n++)
                {
                    EnterpriseFund.Model.cboAllowanceFile model = new cboAllowanceFile();
                    model.FAllowanceFileID = ds.Tables[0].Rows[n]["FAllowanceFileID"].ToString();
                    model.FFileName = ds.Tables[0].Rows[n]["FFileName"].ToString();
                    model.FFileNo = ds.Tables[0].Rows[n]["FFileNo"].ToString();
                    model.FFinancePropName = ds.Tables[0].Rows[n]["FFinancePropName"].ToString();
                    model.FFinancePropNo = ds.Tables[0].Rows[n]["FFinancePropNo"].ToString();
                    model.FSource = ds.Tables[0].Rows[n]["FSource"].ToString();
                    modelList.Add(model);
                }
            }
            return modelList;
        }
                /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(EnterpriseFund.Model.AllowanceFile model)
        {
            return dal.Update(model);
        }
                /// <summary>
        /// 获取最大批号
        /// </summary>
        public int GetMaxPeriod(string year, string FFinancePropNo)
        {
            return dal.GetMaxPeriod(year, FFinancePropNo);
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
        /// <summary>
        /// 获得前几行数据
        /// </summary>
        public DataSet GetList(int Top, string strWhere, string filedOrder)
        {
            return dal.GetList(Top, strWhere, filedOrder);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<EnterpriseFund.Model.AllowanceFile> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<EnterpriseFund.Model.AllowanceFile> DataTableToList(DataTable dt)
        {
            List<EnterpriseFund.Model.AllowanceFile> modelList = new List<EnterpriseFund.Model.AllowanceFile>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                EnterpriseFund.Model.AllowanceFile model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = dal.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }


        public bool VerifyFile(string fAllowanceFileID)
        {
            return dal.VerifyFile(fAllowanceFileID);
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public int GetRecordCount(string strWhere)
        {
            return dal.GetRecordCount(strWhere);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex)
        {
            return dal.GetListByPage(strWhere, orderby, startIndex, endIndex);
        }
        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  BasicMethod
        #region  ExtensionMethod

        #endregion  ExtensionMethod
    }
}

